<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/tld/sys.tld" prefix="sys" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>接口传输日志</title>
    <style type="text/css">
    </style>
    <jsp:include page="../../import.jsp" flush="true"/>
    <script type="text/javascript">
        var arrFoundCode = [];
        <c:forEach items="${fundRasInsList}" var= "module">
        var item  = {"fundRasInsId":"${module.id}","fundRasInsNmShow":"${module.fundRasInsNmShow}"};
        arrFoundCode.push(item);
        </c:forEach>

        var grid = null;
        $(function () {
            $("#ligergrid1").ligerGrid({
                url: '<%=path%>/infside/inftranslog/queryInfTransLogList.do',
                method : 'get',
                columns: [
                    { display: '状态', name: 'statusDesc', minWidth: 100, align: 'center', enabledSort:true},
                    { display: '响应描述', name: 'respDesc', minWidth: 150, align: 'center', enabledSort:true},
                    { display: '响应码', name: 'respCode', minWidth: 150, align: 'center', enabledSort:true},
                    //{ display: '第三方机构', name: 'fundRasInsNm', minWidth: 100, align: 'center', enabledSort:true},
                    {display: '第三方机构', name: 'fundRasInsNm', width: 100, align: 'center', enabledSort: false,
                        render: function (rowdata, index, value) {
                            if (rowdata.fundRasInsId && ("" + rowdata.fundRasInsId).trim()) {
                                if(arrFoundCode){
                                    for (var i=0;i<arrFoundCode.length;i++) {
                                        if(arrFoundCode[i].fundRasInsId == rowdata.fundRasInsId){
                                            return  arrFoundCode[i].fundRasInsNmShow;
                                        }
                                    }
                                }
                            }
                        }
                    },
                    { display: '操作动作', name: 'actionDesc', minWidth: 100, align: 'center', enabledSort:true},
                    { display: '合同号', name: 'lsCntNo', minWidth: 150, align: 'center', enabledSort:true},
                    { display: '支付表号', name: 'paySchNo', minWidth: 150, align: 'center', enabledSort:true},
                    { display: '承租人', name: 'cstNm', minWidth: 100, align: 'center', enabledSort:true},
                    { display: '所属事业部', name: 'buOrgNm', minWidth: 100, align: 'center', enabledSort:true},
                    { display: '是否删除', name: 'isDelDesc', minWidth: 100, align: 'center', enabledSort:true},
                    { display: '创建时间', name: 'crtTm', minWidth: 100, render:renderDateHms,align: 'center', enabledSort:true},
                    { display: '修改时间', name: 'mdfTm', minWidth: 100, render:renderDateHms,align: 'center', enabledSort:true},
                    {
                        display: '操作',minWidth: 100,align: 'center',
                        render: function (rowdata, rowindex, value){
                            var h1='';
                            if(rowdata.displayButton == 1){
                                //作废日志
                                h1+='<a href="javascript:void(0);" onclick="modifyLog(\''+rowdata.id+'\')">作废</a>';
                            }
                            return h1;
                        }
                    }
                ],
                pageSize:10,
                root:'rows',
                record:'total',
                hideLoadButton : true,
                width: '100%',
                height:380,
                heightDiff:-2,
                rownumbers:true
            });
            grid = liger.get("ligergrid1");
            $("#searchBar").ligerForm();
            $("#searchBtn").click(function(event) {
                var form = new liger.get("searchBar");
                var data = form.getData();
                console.log(data);
                for (name in data){
                    grid.setParm(name,data[name]);
                };
                grid.reload();
            });
            $("#clearBtn").click(function(event) {
                clearLigerForm("searchBar");
            });
        });

        //格式化时间
        function renderDate(rowdata, index, value){
            var dateStr = "";
            if(null != value){
                var date = new Date(value);
                dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DD);
            }
            return dateStr;
        }

        //格式化时间
        function renderDateHms(rowdata, index, value){
            var dateStr = "";
            if(null != value){
                var date = new Date(value);
                dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DDHHMMSS);
            }
            return dateStr;
        }

        //修改日志
        function modifyLog(id){
            $.ligerDialog.confirm("是否确认此操作?", function (flag) {
                if(flag == false)return;
                var wait_dialog;
                $.ajax({
                    type: 'post',
                    dataType:'json',
                    data:'id='+id,
                    url: '<%=path%>/infside/inftranslog/modifyLog.do',
                    beforeSend: function(){
                        wait_dialog=$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING ,SQ_type: "waitting" });
                    },
                    success:function(msg){
                        wait_dialog.close();
                        if(msg.success == 1){
                            $.ligerDialog.SQalert({content:msg.info, SQ_type: "success"});
                            grid.reload();
                        }else{
                            $.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
                        }
                    }
                });
            });
        }

    </script>
</head>
<body class="iframeBody">
<div class="Wrapper">
    <div class="searchArea">
        <form id="searchBar">
            <div class="fieldset1 clearFix">
                <div class="fieldBox">
                    <div class="label">状态</div>
                    <div class="field">
                        <select name="status"  id="status"  disabled="disabled">
                            <option value="  " selected="selected">--请选择--</option>
                            <c:forEach items="${statusList}" var="opt">
                                <option value="${opt.key}">${opt.value}</option>
                            </c:forEach>
                        </select>
                    </div>
                </div>
                <div class="fieldBox">
                    <div class="label">合同号</div>
                    <div class="field">
                        <input name="lsCntNo" id="lsCntNo" type="text" class="ui-textbox" value="">
                    </div>
                </div>
                <div class="fieldBox">
                    <div class="label">支付表编号</div>
                    <div class="field">
                        <input name="paySchNo" id="paySchNo" type="text" class="ui-textbox" value="">
                    </div>
                </div>
                <div class="fieldBox">
                    <div class="label">承租人</div>
                    <div class="field">
                        <input name="cstNm" id="cstNm" type="text" class="ui-textbox" value="">
                    </div>
                </div>
                <div class="fieldBox">
                    <div class="fieldBox">
                        <div class="label">身份证号</div>
                        <div class="field">
                            <input name="certNo" id="certNo" type="text" class="ui-textbox" value="">
                        </div>
                    </div>
                </div>
                <div class="fieldBox" style="height: 30px;">
                    <div <sys:resourceAuth resCd="noThdOrg">style="display: none" </sys:resourceAuth>>
                        <div class="label">第三方机构</div>
                        <div class="field">
                            <select name="fundRasInsId" id="fundRasInsId">
                                <option value=" " seleted>请选择</option>
                                <c:forEach items="${fundRasInsList }" var="fundRasIns">
                                    <option value="${fundRasIns.id}">${fundRasIns.fundRasInsNmShow}</option>
                                </c:forEach>
                            </select>
                        </div>
                    </div>
                </div>
                <div class="fieldBox" style="height: 30px;">
                    <div class="label">操作动作</div>
                    <div class="field">
                        <select name="action"  id="action"  disabled="disabled">
                            <option value="  " selected="selected">--请选择--</option>
                            <c:forEach items="${actionList}" var="opt">
                                <option value="${opt.key}">${opt.value}</option>
                            </c:forEach>
                        </select>
                    </div>
                </div>
                <div class="fieldBox">
                    <div class="label">所属事业部</div>
                    <div class="field">
                        <select name="buOrgCd" id="buOrgCd">
                            <option value=" " seleted>请选择</option>
                            <c:forEach items="${orgListList }" var="org">
                                <c:if test="${currentBuOrgCd == org.key }">
                                    <option value="${org.key }" selected>${org.value }</option>
                                </c:if>
                                <c:if test="${currentBuOrgCd != org.key }">
                                    <option value="${org.key }">${org.value }</option>
                                </c:if>
                            </c:forEach>
                        </select>
                    </div>
                </div>
                <div class="fieldBox">
                    <div class="label">是否删除</div>
                    <div class="field">
                        <select name="isDel" id="isDel">
                            <option value="0" seleted>否</option>
                            <option value="1" seleted>是</option>
                        </select>
                    </div>
                </div>
                <div class="clearFix"></div>
                <div class="btnsBox">
                    <span id="searchBtn" class="sq-button sq-button-hasicon"><i class="sqBtnIco_1"></i>查询</span>
                    <span id="clearBtn" class="sq-button sq-button-hasicon"><i class="sqBtnIco_19"></i>清空</span>
                    <input id="resetBtn" type="reset" value="重置" class="l-button l-button-reset Hide"/>
                </div>
            </div>
        </form>
    </div>
</div>
<div id="ligergrid1" class="sq-grid"></div>
</body>
</html>